cmake_minimum_required(VERSION 3.20)
project(SGL)

set(CMAKE_CXX_STANDARD 20)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/api/capi/include")

message(STATUS "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
    message(STATUS "Running on Linux")
    set(SHADER_COMPILER "glslang")
    add_definitions(-DENABLE_PNG=1)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
    message(STATUS "Running on windows")
    add_compile_options(-DENABLE_WIN64=1)
    set(VULKAN_SDK_PATH "D:/VulkanSDK")
    set(SHADER_COMPILER "${VULKAN_SDK_PATH}/Bin/glslang.exe")
    include_directories("${VULKAN_SDK_PATH}/Include")
    link_directories("${VULKAN_SDK_PATH}/Lib")
elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
    message(STATUS "Running on OH")
    add_definitions(-DOS_OPEN_HARMONY)
    set(OH_SDK_PATH "C:/Huawei/DevEcoStudio/sdk")
    include_directories("${OH_SDK_PATH}/default/openharmony/native/sysroot/usr/include")
    add_compile_options(-fdeclspec)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    message(STATUS "Running on macOS")
    add_definitions(-DENABLE_PNG=1)
    set(VULKAN_SDK_PATH "/Users/neo/VulkanSDK/1.4.321.0")
    set(SHADER_COMPILER "${VULKAN_SDK_PATH}/macOS/bin/glslang")
    include_directories("/usr/local/include")
    link_directories("${VULKAN_SDK_PATH}/macOS/lib/")
    link_directories("/opt/homebrew/lib/")
    include_directories("/opt/homebrew/Cellar/glm/1.0.1/include")
    add_compile_options(-fdeclspec)
endif ()

if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
    add_compile_options(-O3 -march=armv8-a+simd)
endif ()

add_subdirectory(runtime)
add_subdirectory(core/image)
add_subdirectory(core/renderer)
add_subdirectory(core/compute)
add_subdirectory(api/capi)
add_subdirectory(examples)

add_subdirectory(sycl)
